import org.junit.*;
import org.junit.runner.*;
import org.junit.runner.notification.*;
import static org.junit.Assert.*;

public class LinkedListTest {

    public static void main(String[] args) {
        Result result = JUnitCore.runClasses(LinkedListTest.class);
        for (Failure failure : result.getFailures()) {
            System.out.println(failure.getTestHeader() + ": " + failure.getMessage());
        }
        System.out.println(result.wasSuccessful());
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }
    
    @Test
    public void test1() {
        LinkedList<Integer> list = new LinkedList<Integer>();
        list.add(0);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);

        assertEquals("1. Size test", 6, list.size());
    }

    @Test
    public void test2() {
        LinkedList<Integer> list = new LinkedList<Integer>();
        list.add(0);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);

        list.reverseI();
       
        assertEquals("2. Reverse iterative", "0 1 2 3 4 5 ", list.toString());
    }

    @Test
    public void test3() {
        LinkedList<Integer> list = new LinkedList<Integer>();
        list.add(0);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);

        list.reverseR(list.head);
        
        assertEquals("3. Reverse recursive", "0 1 2 3 4 5 ", list.toString());
    }

    @Test
    public void test4() {
        LinkedList<Integer> list = new LinkedList<Integer>();
        list.add(0);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);

        list.reverseInsert();
       
        assertEquals("2. Insert-Revert algorithm", "0 1 2 3 4 5 ", list.toString());
    }

}


